﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="Web.Admin.Page_Module.Edit" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>

<!DOCTYPE html>

<%="<!--[if IE 8]> <html class=\"ie8 no-js\"> <![endif]-->"%>
<%="<!--[if IE 9]> <html class=\"ie9 no-js\"> <![endif]-->"%>
<%="<!--[if !IE]><!-->"%>
<html>
<%="<!--<![endif]-->"%>
    <!-- BEGIN HEAD -->

    <head>
        <meta charset="utf-8" />
        <title><%=Evan.Common.CommFun.GetAppSetting("AdminTitle") %> - 后台管理系统</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta content="width=device-width, initial-scale=1" name="viewport" />
        <!-- #include file="../include/com_res_css.inc" -->

        <link rel="stylesheet" href="<%=SiteConfig.WebAdminPath %>assets/codemirror/lib/codemirror.css">
        <link rel="stylesheet" href="<%=SiteConfig.WebAdminPath %>assets/codemirror/addon/display/fullscreen.css">
        
        <link rel="stylesheet" href="<%=SiteConfig.WebAdminPath %>assets/codemirror/theme/panda-syntax.css">
        

        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/lib/codemirror.js"></script>
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/lib/formatting.js"></script>

        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/mode/xml/xml.js"></script>

        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/addon/comment/comment.js"></script>
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/addon/comment/continuecomment.js"></script>
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/addon/edit/matchbrackets.js"></script>
        
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/mode/javascript/javascript.js"></script>

        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/mode/htmlmixed/htmlmixed.js"></script>
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/addon/mode/multiplex.js"></script>
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/mode/htmlembedded/htmlembedded.js"></script>

        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/mode/css/css.js"></script>
        
        <script src="<%=SiteConfig.WebAdminPath %>assets/codemirror/addon/display/fullscreen.js"></script>

    </head>
    <!-- END HEAD -->

    <body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
        <!-- BEGIN HEADER -->
        
        <!-- #include file="../include/top_bar.inc" -->

        <!-- END HEADER -->
        <!-- BEGIN HEADER & CONTENT DIVIDER -->
        <div class="clearfix"> </div>
        <!-- END HEADER & CONTENT DIVIDER -->
        <!-- BEGIN CONTAINER -->
        <div class="page-container">
            <!-- BEGIN SIDEBAR -->
            
            <!-- #include file="../include/left_menu.inc" -->
            
            <!-- END SIDEBAR -->
            <!-- BEGIN CONTENT -->
            <div class="page-content-wrapper">
                <!-- BEGIN CONTENT BODY -->
                <div class="page-content">
                    <!-- BEGIN PAGE HEADER-->
                    <!-- BEGIN THEME PANEL -->
                    <!-- #include file="../include/theme_panel.inc" -->
                    <h3 class="page-title"> 栏目管理</h3>
                    <!-- END PAGE TITLE-->
                    <!-- END PAGE HEADER-->
                    <!-- BEGIN PAGE CONTENT-->

                                    <div class="portlet light bordered">
                                        <div class="portlet-title tabbable-line">

                                            <ul class="nav nav-tabs ">
                                                <li class="active">
                                                    <a href="#tab_1" data-toggle="tab" aria-expanded="true"> 基本信息 </a>
                                                </li>
                                            </ul>
                                        
                                            <div class="caption">
                                                <i class="glyphicon glyphicon-list-alt font-red"></i>
                                                <span class="caption-subject font-red bold uppercase">模块管理</span>
                                            </div>

                                        </div>
                                        <div class="tab-content">

                                            <div class="tab-pane active" id="tab_1">
                                                <div class="form">
                                                    <div class="form-horizontal form-row-seperated">
                                                        <div class="form-body">

                                                           <%-- <div class="form-group">
                                                                <label class="control-label col-md-3">普通文本框</label>
                                                                <div class="col-md-5">
                                                                    <input type="text" class="form-control" placeholder="请输入标题">
                                                                    <span class="help-block">提示信息</span>
                                                                </div>
                                                            </div>   

                                                            <div class="form-group">
                                                                <label class="control-label col-md-3">普通密码框</label>
                                                                <div class="col-md-5">
                                                                    <input type="password" class="form-control" placeholder="请输入密码">
                                                                    <span class="help-block">提示信息</span>
                                                                </div>
                                                            </div>   --%>

                                                            
                                                            <% 
                                                                
                                                              
                                                                Evan.Model.SysModel.HtmlHelperModel m1 = new Evan.Model.SysModel.HtmlHelperModel { Title = "标题", PlaceHoder = "模块标题", Notice = "模块标题", FieldName = "Title", FieldVerify = "notnull", MaxLength = 50, FieldType = "input" };
                                                                Evan.Model.SysModel.HtmlHelperModel m2 = new Evan.Model.SysModel.HtmlHelperModel { Title = "模块简介", PlaceHoder = "模块简介", Notice = "模块简介", FieldName = "Intro", FieldVerify = "", MaxLength = 100, FieldType = "input" };
                                                                Evan.Model.SysModel.HtmlHelperModel m3 = new Evan.Model.SysModel.HtmlHelperModel { Title = "缩略图", PlaceHoder = "缩略图", Notice = "缩略图", FieldName = "ImgUrl", FieldVerify = "notnull", MaxLength = 0, FieldType = "imgupload" };
                                                                Evan.Model.SysModel.HtmlHelperModel m4 = new Evan.Model.SysModel.HtmlHelperModel { Title = "HTML代码", PlaceHoder = "HTML代码", Notice = "HTML代码", FieldName = "Html", FieldVerify = "notnull", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m5 = new Evan.Model.SysModel.HtmlHelperModel { Title = "CSS代码", PlaceHoder = "CSS代码", Notice = "CSS代码", FieldName = "Css", FieldVerify = "notnull", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m6 = new Evan.Model.SysModel.HtmlHelperModel { Title = "JS代码", PlaceHoder = "JS代码", Notice = "JS代码", FieldName = "Js", FieldVerify = "notnull", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m7 = new Evan.Model.SysModel.HtmlHelperModel { Title = "CSS Json代码", PlaceHoder = "CSS Json代码", Notice = "CSS Json代码", FieldName = "CssJson", FieldVerify = "notnull", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m8 = new Evan.Model.SysModel.HtmlHelperModel { Title = "CSS 媒体查询代码", PlaceHoder = "CSS 媒体查询代码", Notice = "CSS 媒体查询代码", FieldName = "CssMediaQuery", FieldVerify = "", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m9 = new Evan.Model.SysModel.HtmlHelperModel { Title = "是否可以绑定数据", PlaceHoder = "绑定", Notice = "数据绑定", FieldName = "CanBind", FieldVerify = "notnull", MaxLength = 0, FieldType = "switch" };

                                                                Evan.Model.SysModel.HtmlHelperModel m11 = new Evan.Model.SysModel.HtmlHelperModel { Title = "模块绑定程序", PlaceHoder = "模块绑定程序", Notice = "模块绑定程序", FieldName = "BindHtml", FieldVerify = "notnull", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m12 = new Evan.Model.SysModel.HtmlHelperModel { Title = "模块绑定可视化编辑", PlaceHoder = "模块绑定可视化编辑", Notice = "模块绑定可视化编辑", FieldName = "BindEdit", FieldVerify = "", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m13 = new Evan.Model.SysModel.HtmlHelperModel { Title = "示例数据", PlaceHoder = "示例数据", Notice = "示例数据", FieldName = "Demo", FieldVerify = "notnull", MaxLength = 0, FieldType = "textarea" };
                                                                Evan.Model.SysModel.HtmlHelperModel m14 = new Evan.Model.SysModel.HtmlHelperModel { Title = "是否热门", PlaceHoder = "是否热门", Notice = "是否热门", FieldName = "IsHot", FieldVerify = "notnull", MaxLength = 0, FieldType = "input" };
                                                                Evan.Model.SysModel.HtmlHelperModel m15 = new Evan.Model.SysModel.HtmlHelperModel { Title = "排序ID", PlaceHoder = "排序ID", Notice = "排序ID", FieldName = "SortId", FieldVerify = "notnull", MaxLength = 0, FieldType = "input", DefaultValue = "100" };
                                                                Evan.Model.SysModel.HtmlHelperModel m16 = new Evan.Model.SysModel.HtmlHelperModel { Title = "状态", PlaceHoder = "锁定", Notice = "是否锁定", FieldName = "States", FieldVerify = "notnull", MaxLength = 0, FieldType = "switch" };
                                                                Evan.Model.SysModel.HtmlHelperModel m17 = new Evan.Model.SysModel.HtmlHelperModel { Title = "模块用到的表", PlaceHoder = "模块用到的表", Notice = "模块用到的表", FieldName = "TableName", FieldVerify = "", MaxLength = 0, FieldType = "input" };
                                                                Evan.Model.SysModel.HtmlHelperModel m18 = new Evan.Model.SysModel.HtmlHelperModel { Title = "模块用到的字段", PlaceHoder = "模块用到的字段", Notice = "模块用到的字段", FieldName = "Fields", FieldVerify = "", MaxLength = 0, FieldType = "textarea" };
                                                            %>

                                                            <% List<Evan.Model.SysModel.HtmlHelperModel> mm = new List<Evan.Model.SysModel.HtmlHelperModel> ();
                                                               
                                                               mm.Add(m1);
                                                               //mm.Add(m2);
                                                               //mm.Add(m3);
                                                               mm.Add(m4);
                                                               mm.Add(m5);
                                                               mm.Add(m8);
                                                               mm.Add(m7);
                                                               
                                                               mm.Add(m6);
                                                               
                                                               
                                                               mm.Add(m9);
                                                               
                                                               mm.Add(m11);
                                                               mm.Add(m12);
                                                               mm.Add(m13);
                                                               mm.Add(m14);
                                                               mm.Add(m15);
                                                               mm.Add(m16);
                                                               mm.Add(m17);
                                                               mm.Add(m18);
                                                                %>

                                                            <% foreach (Evan.Model.SysModel.HtmlHelperModel item in mm)
                                                               {
                                                                   Response.Write(Evan.Common.HtmlHelper.HtmlBuild(item));
                                                               }
                                                            %>

                                                            
                                                                
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="tab-pane hide" id="tab_2">
                                                
                                            </div>
                                            <div class="tab-pane hide" id="tab_3">
                                                
                                            </div>

                                        </div>


                                        <div class="form-actions form-submit-row">
                                            <div class="form-group">
                                                <label class="control-label col-md-2"></label>
                                                <div class="col-md-6">
                                                    <button type="button" class="btn green submit" ><i class="fa fa-check"></i> 提交</button>
                                                    <button type="button" class="btn default" onclick="JumpList();"><i class="fa fa-mail-reply"></i> 返回</button>
                                                </div>
                                            </div>  
                                            <div class="clear"></div>
                                        </div>

                                    </div>

                    
                    <!-- END PAGE CONTENT-->
                </div>
                <!-- END CONTENT BODY -->
            </div>
            <!-- END CONTENT -->
            
        </div>
        <!-- END CONTAINER -->
        <!-- #include file="../include/footer.inc" -->
   <!-- #include file="../include/com_res_js.inc" -->
    </body>
  <script  type="text/javascript">
      var model = <%=(Evan.Model.ConvertModel.ConvertToJson(Model))%>;
      SetModel(model);
      model.ClassId=GetQs("classid");
  </script>
   <script type="text/javascript">
       $(function(){
           $("input[field='Title']").attr("disabled","disabled");

           var cm_mode = {
               javascript:"text/javascript",
               json:"application/json",
               css:"text/css",
               html:"text/html",
               aspnet:"application/x-aspx",
           };

           $("textarea[field='Html']").attr("id","field_Html").attr("data-cm-mode","html");
           $("textarea[field='Css']").attr("id","field_Css").attr("data-cm-mode","css");
           $("textarea[field='CssMediaQuery']").attr("id","field_CssMediaQuery").attr("data-cm-mode","json");
           $("textarea[field='CssJson']").attr("id","field_CssJson").attr("data-cm-mode","json");
           $("textarea[field='Js']").attr("id","field_Js").attr("data-cm-mode","javascript");
           $("textarea[field='BindHtml']").attr("id","field_BindHtml").attr("data-cm-mode","aspnet");
           $("textarea[field='BindEdit']").attr("id","field_BindEdit").attr("data-cm-mode","aspnet");
           $("textarea[field='Demo']").attr("id","field_Demo").attr("data-cm-mode","html");
           $("textarea[field='Fields']").attr("id","field_Fields").attr("data-cm-mode","json");

           $("textarea[data-cm-mode]").each(function(i,e){
               var _this = $(this);
               //console.log(i,e,_this.attr("id"),_this.attr("data-cm-mode"),cm_mode[_this.attr("data-cm-mode")]);

               CodeMirror.fromTextArea(document.getElementById(_this.attr("id")), {
                   lineNumbers: true,
                   mode: cm_mode[_this.attr("data-cm-mode")],
                   theme: "panda-syntax",
                   lineWrapping:true,
                   dragDrop:false,
                   flattenSpans:false,
                   extraKeys: {
                       "F11": function(cm) {
                           cm.setOption("fullScreen", !cm.getOption("fullScreen"));
                       },
                       "Esc": function(cm) {
                           if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
                       },
                       'Ctrl-S': function(cm){ 
                           cm.getTextArea().value = cm.getValue();
                           return false;
                       },
                       "F7": function autoFormat(editor) {
                           var totalLines = editor.lineCount();
                           editor.autoFormatRange({line:0, ch:0}, {line:totalLines});
                       }//代码格式化
                   }
               }).on("change",function(cm,obj) {
                   //实时将数据存入textarea
                   cm.getTextArea().value = cm.getValue();
               });

           });


       });
   </script>
</html>



